lobsterh5.main({
    data: {
    },
    pageload() {
        var self = this;
        self.initevent();
    },
    initevent() {
        var self = this;

        var tmpl = '<li class="weui-uploader__file" style="background-image:url(#url#)"></li>';
        var $uploaderInput = $("#uploaderInput"); //上传按钮+
        var $uploaderFiles = $("#uploaderFiles");    //图片列表
        var $galleryImg = $(".weui-gallery__img");//相册图片地址
        var $gallery = $(".weui-gallery");

        //上传文件
        lobsterh5.OSSUploadFile('#uploaderInput', function (res) {
            console.log(res);
            //self.data.$layui.element.progress('progress', Math.round(res * 100) + '%');
        }, function (res) {
            console.log(res);
            // $("#ImgUrl").attr("src", res.url);
            // $("input[name='ImgUrl']").val(res.url);
            $uploaderFiles.append($(tmpl.replace('#url#', res.url)));
        });
        
        $uploaderFiles.on("click", "li", function () {
            $galleryImg.attr("style", this.getAttribute("style"));
            console.log(this)
            $gallery.fadeIn(100);
        });
        $('.weui-gallery__img').on("click", function () {
            $gallery.fadeOut(100);
        });
        $('.weui-gallery__opr').on("click", function (obj) {
            $.confirm('您确定要删除吗?', '确认删除?', function () {
                $(obj).remove();
            });
            return false;
        });
    },
}); 